package com.tpc.control.jpa;

import javax.persistence.AttributeOverride;
import javax.persistence.AttributeOverrides;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

/**
 * PlantColumn entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "plant_column", catalog = "production_control")
public class PlantColumn implements java.io.Serializable {

	// Fields

	private PlantColumnId id;
	private Plant plant;
	private String colDescription;

	// Constructors

	/** default constructor */
	public PlantColumn() {
	}

	/** full constructor */
	public PlantColumn(PlantColumnId id, Plant plant, String colDescription) {
		this.id = id;
		this.plant = plant;
		this.colDescription = colDescription;
	}

	// Property accessors
	@EmbeddedId
	@AttributeOverrides( {
			@AttributeOverride(name = "plant", column = @Column(name = "plant", nullable = false, length = 4)),
			@AttributeOverride(name = "colName", column = @Column(name = "col_name", nullable = false, length = 20)) })
	public PlantColumnId getId() {
		return this.id;
	}

	public void setId(PlantColumnId id) {
		this.id = id;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "plant", nullable = false, insertable = false, updatable = false)
	public Plant getPlant() {
		return this.plant;
	}

	public void setPlant(Plant plant) {
		this.plant = plant;
	}

	@Column(name = "col_description", nullable = false, length = 40)
	public String getColDescription() {
		return this.colDescription;
	}

	public void setColDescription(String colDescription) {
		this.colDescription = colDescription;
	}

}